from django.contrib.auth.models import Group
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet

from user_app.models import User
from user_app.serializers.group import GroupSerializers
from user_app.serializers.user import UserSerializer
from utils.rest_pagination import MyPagination


class AdminView(ModelViewSet):
    queryset = User.objects.filter(is_staff=True)
    serializer_class = UserSerializer
    pagination_class = MyPagination

    def simple(self, request):
        query = Group.objects.all()
        ser = GroupSerializers(query, many=True)
        return Response(ser.data)
